//
//  MenuViewController.m
//  MyFairLady
//
//  Created by 客官大大 on 15/5/23.
//  Copyright (c) 2015年 蓝鸥. All rights reserved.
//

#import "MenuViewController.h"
#import "homePageViewController.h"
#import "AppDelegate.h"
#import "SeasonViewController.h"
#import "dddViewController.h"
@interface MenuViewController ()

@end

@implementation MenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStylePlain target:self action:@selector(showMenu)];

    
    // Do any additional setup after loading the view.
}
- (void)showMenu
{
    if (!_sideMenu) {
        RESideMenuItem *homeItem = [[RESideMenuItem alloc] initWithTitle:@"首页" action:^(RESideMenu *menu, RESideMenuItem *item) {
            homePageViewController *viewController = [[homePageViewController alloc] init];
            viewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
            [menu setRootViewController:navigationController];
        }];
        RESideMenuItem *exploreItem = [[RESideMenuItem alloc] initWithTitle:@"季节" action:^(RESideMenu *menu, RESideMenuItem *item) {
                    SeasonViewController *seaViewController = [[SeasonViewController alloc] init];
                    seaViewController.title = item.title;
                    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
                    [menu setRootViewController:navigationController];
                }];
        RESideMenuItem *jiankangItem = [[RESideMenuItem alloc] initWithTitle:@"健康助手" action:^(RESideMenu *menu, RESideMenuItem *item) {
            dddViewController *seaViewController = [[dddViewController alloc] init];
            seaViewController.title = item.title;
            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:seaViewController];
            [menu setRootViewController:navigationController];
        }];
        
        
        
        _sideMenu = [[RESideMenu alloc] initWithItems:@[homeItem,exploreItem,jiankangItem]];
        _sideMenu.verticalOffset = IS_WIDESCREEN ? 110 : 76;
        //        _sideMenu.hideStatusBarArea = [AppDelegate OSVersion] < 7;
    }
    
    [_sideMenu show];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
